package UI;

import javax.swing.*;
import java.awt.*;

public class MyFrame extends JFrame {
    private JLabel lb1;
    private JLabel lb2;
    private JLabel lb3;
    private JTextField txt1;
    private JTextField txt2;
    private JTextField txt3;
    private JButton btn1;
    private JButton btn2;
    public MyFrame(){
        lb1 = new JLabel("学号：");
        lb2 = new JLabel("姓名：");
        lb3 = new JLabel("年龄：");
        txt1 = new JTextField(10);
        txt2 = new JTextField(10);
        txt3 = new JTextField(10);
        btn1 = new JButton("确定");
        btn2 = new JButton("取消");
        //窗体设置 大小 可见 监听  添加控件
        this.setVisible(true);
        this.setSize(500,400);
        this.setLayout(new GridLayout(4,2));
        this.add(lb1);
        this.add(txt1);
        this.add(lb2);
        this.add(txt2);
        this.add(lb3);
        this.add(txt3);
        this.add(btn1);
        this.add(btn2);
    }
}
